layui.use(['form','layer','layedit','laydate','upload'],function(){
    var form = layui.form
    layer = parent.layer === undefined ? layui.layer : top.layer,
        laypage = layui.laypage,
        upload = layui.upload,
        layedit = layui.layedit,
        laydate = layui.laydate,
        $ = layui.jquery;

    laydate.render({
        elem: '#test1' //指定元素
    });

    //登录按钮
    form.on("submit(submit)",function(data){
        console.log(data.field);
        $.ajax({
            type: "Post",
            url: "addWeiXinLogin",
            dataType: "json",
            data:data.field,
            success: function(msg){
                if(msg.code == '-1'){
                    layer.msg(msg.msg,{time:0.6*1000});
                }

                if(msg.code =='1'){
                    // alert(msg.url);
                     window.location.href  = (msg.url)+ '/article/comment?v='+(new Date().getTime());
                    // var nextPage = document.createElement('a');
                    // nextPage.setAttribute('href',msg.url);
                    // nextPage.click();
                }
            }
        });
        return false;
    })



})